﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace BigPang.Render
{
    public class Camera
    {
        public const float Frequency = 1000f;

        int x;
        int y;

        int offsetX;
        int offsetY;

        int mLastTime;
        float Eng;

        public int X
        {
            get { return x + offsetX; }
            set { x = value; }
        }

        public int Y
        {
            get { return y + offsetY; }
            set { y = value; }
        }

        public void AddShake( float e )
        {
            Eng = e;
            mLastTime = Environment.TickCount;
        }

        public void ProcessTick()
        {
            float elapsedTime = (Environment.TickCount - mLastTime) / 1000.0f;

            double v = (1 / (Math.Pow(Math.E, elapsedTime * 7) + 1)) * Eng * Math.Sin(Frequency * elapsedTime);
            Debug.WriteLine(v);
            offsetY = (int)v;
        }
    }
}
